<template>
	<div id="app">
		<!-- <button @click="clearSessionStorage">clear</button> -->
		<router-view v-if="getLevelone" />
	</div>
</template>

<script>
import Axios from 'Axios';
import { mapState, mapGetters, mapMutations } from 'vuex';
import {
	UPDATE_STATE,
	CLEAR_SESSIONSTORAGE
} from './store/mutation-types';

export default {
	name: 'App',
	data() {
		return {
		}
	},
	created() {
		// 初始化游戏难度配置信息
		this.$store.dispatch('getMinesConfig');
		this.getSessionStorage;
	},
	computed: {
		...mapGetters([
			'getToken',
			'getLevelone',
			'getSessionStorage'
		])
	},
	methods: {
		
	},
	watch: {
		getToken: function (newToken, oldToken) {
			if (!newToken) {
				let routeStr = 'login';
				let path = this.$route.path;
				if (path.match(/register/)) {
					routeStr = 'register'
				}
				this.$router.push(routeStr)
			}
		}
	}
}
</script>

<style lang="scss" scoped>
#app {
  width: 100%;
  height: 100%;
  background: #37353a;
}
</style>
